package CommonUtil;

import com.ceshiren.entity.AData;
import com.ceshiren.entity.Add;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;
/*
解析yaml文件
 */
public class CommonUtil {
    public static Add getYaml(String path) {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        TypeReference<Add> typeReference = new TypeReference<Add>() {};
        Add  add = null;
        try {
            add = mapper.readValue(
                    new File("./src/test/resources/"+path), typeReference);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return add;
    }


}
